@extends('layouts.header')
@inject('sender','App\Http\Controllers\WroteitController')
@section('content')
<h2 style="text-align: center;">Inbox</h2>
@foreach($messages as $message)
    @if (Auth::user()->id == $message->to_id)
        <div style="text-align: left;">
            <h3 style="padding-top: 15px;"><a href="{{ route('show_message',['mes'=>$message->id]) }} " title="Show message">{{$message->title}}</a></h3> 
            <h4>from {{$sender::getSender($message)->name}} at {{$message->created_at}}</h4>
        </div>        
    @endif
@endforeach
@endsection()